package com.arpa.oms.domain.entity;

import com.arpa.wms.domain.entity.BasicEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Digits;
import javax.validation.constraints.NotEmpty;
import java.math.BigDecimal;

/**
 * <p>
 * OMS调拨单明细
 * </p>
 *
 * @author LEO
 * @since 2020-11-17
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel(value="OmsAllocationItem对象", description="OMS调拨单明细")
public class OmsAllocationItem extends BasicEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "数据标识")
    @TableField("code")
    private String code;

    @ApiModelProperty(value = "调拨单号")
    @TableField("allocation_code")
    private String allocationCode;

    @ApiModelProperty(value = "商品标识")
    @TableField("goods_code")
    @NotEmpty(message = "调拨单明细商品不能为空！", groups = {OmsAllocation.Save.class, OmsAllocation.Update.class})
    private String goodsCode;

    @ApiModelProperty(value = "商品编码")
    @TableField("good_code")
    @NotEmpty(message = "调拨单明细商品编码不能为空！", groups = {OmsAllocation.Save.class, OmsAllocation.Update.class})
    private String goodCode;

    @ApiModelProperty(value = "商品名称")
    @TableField("goods_name")
    @NotEmpty(message = "调拨单明细商品名称不能为空！", groups = {OmsAllocation.Save.class, OmsAllocation.Update.class})
    private String goodsName;

    @ApiModelProperty(value = "商品条码")
    @TableField("goods_bar_code")
    @NotEmpty(message = "调拨单明细商品条码不能为空！", groups = {OmsAllocation.Save.class, OmsAllocation.Update.class})
    private String goodsBarCode;

    @ApiModelProperty(value = "商品规格")
    @TableField("spec")
    private String spec;

    @ApiModelProperty(value = "商品保质期（天）")
    @TableField("expiration_quantity")
    @Digits(integer = 20, fraction = 6, groups = {OmsAllocation.Save.class, OmsAllocation.Update.class})
    private BigDecimal expirationQuantity;

    @ApiModelProperty(value = "基本单位数量")
    @TableField("quantity")
    @Digits(integer = 20, fraction = 6, groups = {OmsAllocation.Save.class, OmsAllocation.Update.class})
    private BigDecimal quantity;

    @ApiModelProperty(value = "调拨单位数量")
    @TableField("unit_quantity")
    @DecimalMin(value = "0.000001", message = "调拨单明细调拨数量数量过小", groups = {OmsAllocation.Save.class, OmsAllocation.Update.class})
    @Digits(integer = 20, fraction = 6, groups = {OmsAllocation.Save.class, OmsAllocation.Update.class})
    private BigDecimal unitQuantity;

    @ApiModelProperty(value = "基本单位出库数量")
    @TableField("outbound_quantity")
    @Digits(integer = 20, fraction = 6, groups = {OmsAllocation.Save.class, OmsAllocation.Update.class})
    private BigDecimal outboundQuantity;

    @ApiModelProperty(value = "单位出库数量")
    @TableField("unit_outbound_quantity")
    @Digits(integer = 20, fraction = 6, groups = {OmsAllocation.Save.class, OmsAllocation.Update.class})
    private BigDecimal unitOutboundQuantity;

    @ApiModelProperty(value = "基本单位入库数量")
    @TableField("inbound_quantity")
    @Digits(integer = 20, fraction = 6, groups = {OmsAllocation.Save.class, OmsAllocation.Update.class})
    private BigDecimal inboundQuantity;

    @ApiModelProperty(value = "单位入库数量")
    @TableField("unit_inbound_quantity")
    @Digits(integer = 20, fraction = 6, groups = {OmsAllocation.Save.class, OmsAllocation.Update.class})
    private BigDecimal unitInboundQuantity;

    @ApiModelProperty(value = "件装量")
    @TableField("unit_convert_quantity")
    @Digits(integer = 20, fraction = 6, groups = {OmsAllocation.Save.class, OmsAllocation.Update.class})
    private BigDecimal unitConvertQuantity;

    @ApiModelProperty(value = "调拨单位")
    @TableField("unit_code")
    @NotEmpty(message = "调拨单明细调拨单位不能为空！", groups = {OmsAllocation.Save.class, OmsAllocation.Update.class})
    private String unitCode;

    @ApiModelProperty(value = "调拨单位名称")
    @TableField("unit_name")
//    @NotEmpty(message = "调拨单明细调拨单位名称不能为空！", groups = {OmsAllocation.Save.class, OmsAllocation.Update.class})
    private String unitName;

    @ApiModelProperty(value = "基本单位")
    @TableField("basic_unit")
    @NotEmpty(message = "调拨单明细基本单位不能为空！", groups = {OmsAllocation.Save.class, OmsAllocation.Update.class})
    private String basicUnit;

    @ApiModelProperty(value = "基本单位名称")
    @TableField("basic_unit_name")
    @NotEmpty(message = "调拨单明细基本单位名称不能为空！", groups = {OmsAllocation.Save.class, OmsAllocation.Update.class})
    private String basicUnitName;

    @ApiModelProperty(value = "备注")
    @TableField("remarks")
    @Length(max = 255, message = "调拨单明细备注长度不能大于255", groups = {OmsAllocation.Save.class, OmsAllocation.Update.class})
    private String remarks;

    @ApiModelProperty(value = "平均单价")
    @TableField("average_unit_price")
    @Digits(integer = 20, fraction = 6, groups = {OmsAllocation.Save.class, OmsAllocation.Update.class})
    private BigDecimal averageUnitPrice;



}
